<extend name="Layout:ly1"/>

<block name="head">
    <script>
        $(document).ready(function () {
            var Table = $('table');
            var DataTable = Table.DataTable({
                language: dataTables_zh_CN,
                pageLength: 10,
                aaSorting: [
                    [0,"desc"]
                ]
            });

            //删除信息
            $('.delete').click(function(){
                var id = $(this).parents('tr').data('id');
                layer.confirm('你确定要删除吗？', {
                    btn: ['确定','取消'], //按钮
                    shade: [0.4, '#393D49'] //显示遮罩
                }, function(){
                    $.get("{:U('Admin/Feedback/feedback_del')}",{"id": id},function(msg){
                        if(msg == 1){
                            layer.msg("删除成功，1秒后自动关闭~~",{ico:1,time:1000},function(){
                                $('table tr#id_'+id).remove();
                            })
                        }else if(msg == 2){
                            layer.msg("参数异常，1秒后自动关闭~~",{ico:1,time:1000});
                        }else{
                            layer.msg("删除失败，1秒后自动关闭~~",{ico:1,time:1000});
                        }
                    })
                }, function(){

                });
            })
        });
    </script>
</block>

<block name="body">
    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">意见列表</h1>
            </div>
            <!-- /.col-lg-12 -->
        </div>
        <!-- /.row -->
        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        意见列表
                    </div>
                    <!-- /.panel-heading -->
                    <div class="panel-body">
                        <div class="dataTable_wrapper">
                            <table class="table table-bordered table-hover">
                                <thead>
                                    <tr>
                                        <th width="5%">ID</th>
                                        <th width="10%">姓名</th>
                                        <th width="10%">邮箱 / 手机号</th>
                                        <th width="35%">内容</th>
                                        <th width="10%">添加时间</th>
                                        <th width="10%">操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <foreach name="data" item="v" key="k" >
                                        <tr id="id_{$v.id}" data-id="{$v.id}">
                                            <td align="center">{$v.id}</td>
                                            <td>{$v.name}</td>
                                            <td>{$v.feed_mail}</span></td>
                                            <td>{$v.feed_content}</td>
                                            <td>{$v.addtime}</td>
                                            <td align="center">
                                                <button class="btn btn-danger delete">删除</button>
                                            </td>
                                        </tr>
                                    </foreach>
                                </tbody>
                            </table>
                        </div>
                        <!-- /.table-responsive -->
                    </div>
                    <!-- /.panel-body -->
                </div>
                <!-- /.panel -->
            </div>
            <!-- /.col-lg-12 -->
        </div>
    </div>
    <!-- /#page-wrapper -->
</block>